package com.zlq.add.AssertTest;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class TestEXPool {
    public static void main(String[] args) {
        //1.提供指定线程池数量的线程池
        ExecutorService service = Executors.newFixedThreadPool(10);

        //设置线程池的属性
        //2.执行指定的线程的操作。需要提供实现Runnable接口或Callable接口实现类的对象
        service.execute(new NumberThread());    //适合适用于Runnable
        //service.submit();     //适用于 Callable
        //3.关闭链接池
        service.shutdownNow();
    }
}

class NumberThread implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            if (i % 2 == 0){
                System.out.println(i);
            }
        }
    }
}
